﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GalaSoft.MvvmLight;
using System.Collections.ObjectModel;
using GalaSoft.MvvmLight.Command;

namespace Asko.Lib.ViewModels
{
    public class GraphViewModel : ViewModelBase
    {
        #region Champs
        private NodeViewModel _noeud;
        #endregion

        #region Méthodes
        public GraphViewModel()
        {            
            this.Edges = new ObservableCollection<EdgeViewModel>();
            this.Nodes = new ObservableCollection<NodeViewModel>();

        }
        /// <summary>
        /// Ajoute un noeud
        /// </summary>
        /// <param name="arc"></param>
        public void AddEdge(EdgeViewModel arc)
        {
            if (arc == null)
            {
                throw new ArgumentNullException();
            }
            this.Edges.Add(arc);
        }
        /// <summary>
        /// Ajoute un arc
        /// </summary>
        /// <param name="noeud"></param>
        public void AddNode(NodeViewModel noeud)
        {
            if (noeud == null)
            {
                throw new ArgumentNullException();
            }
            noeud.Graph = this;
            this.Nodes.Add(noeud);
        }
        /// <summary>
        /// Supprime le noeud
        /// </summary>
        /// <param name="noeud"></param>
        public void RemoveNode(NodeViewModel noeud)
        {

        }
        #endregion

        #region Propriétés
        /// <summary>
        /// Retourne les arcs
        /// </summary>
        public ObservableCollection<EdgeViewModel> Edges
        {
            get;
            private set;
        }
        /// <summary>
        /// Retourne les noeuds
        /// </summary>
        public ObservableCollection<NodeViewModel> Nodes
        {
            get;
            private set;
        }
        #endregion
    }
}
